package net.lzzy.practices.entities;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 结果实体类，用于存储学生作业提交的信息。
 * 继承自 BaseEntity，以获取基本的实体属性。
 */
@Entity
@Getter
@Setter
public class Result extends BaseEntity{
    @Transient
    public static final int TYPE_CORRECT = 0;

    @Transient
    public static final int TYPE_MISS = 1;

    @Transient
    public static final int TYPE_EXTRA = 2;

    @Transient
    public static final int TYPE_WRONG = 3;

    @Transient
    public static final int TYPE_UNDO = 4;

    @Temporal(TemporalType.TIMESTAMP)
    private Date commitTime;

    @ManyToOne
    private Question question;

    @ManyToOne
    private User student;

    @ManyToMany
    private List<Option> options=new ArrayList<>();

    public Result() {
        commitTime = new Date();
    }
}
